import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, IsInt, Min } from 'class-validator';
import { Type } from 'class-transformer';

export class QueryDictDto {
  @ApiProperty({
    description: '字典编码',
    example: 'gender',
    required: false
  })
  @IsOptional()
  @IsString()
  dictCode?: string;

  @ApiProperty({
    description: '字典名称',
    example: '性别',
    required: false
  })
  @IsOptional()
  @IsString()
  name?: string;
  
  @ApiProperty({
    description: '状态(0:禁用;1:正常)',
    example: 1,
    required: false
  })
  @IsOptional()
  @IsInt()
  @Type(() => Number)
  status?: number;

  @ApiProperty({
    description: '页码',
    example: 1,
    required: false,
    default: 1
  })
  @IsOptional()
  @IsInt()
  @Min(1)
  @Type(() => Number)
  pageNum?: number = 1;

  @ApiProperty({
    description: '每页条数',
    example: 10,
    required: false,
    default: 10
  })
  @IsOptional()
  @IsInt()
  @Min(1)
  @Type(() => Number)
  pageSize?: number = 10;
}